#pragma once
#include "../include/enum.h"

/*! \class BackgroundManager
	\brief Handles the loading of the backgrounds for all the application
	
*/
class Application;
class Game;

class BackgroundManager
{
public:

	BackgroundManager(void);
	~BackgroundManager(void);

	AppState loadedBG;
	int bgBottom2, bgBottom3, bgTop2;
	int bgBottom2X, bgBottom3X, bgTop2X;
	unsigned int backgroundTicks, backgroundSpeed;
	bool backgroundScroll;
	int scrollValue;

	/*!	\fn loadBackground
	\brief Load a background on the right screen
	\param data : the image data tab provided by the .h generated by grit
	\param length : of data for the dmaCopy. Only use for scrollFix = 1. Put 0 otherwise.
	\param bgNumber : the background number which should be loaded. Must be 2 or 3.
	\param screen : enum to identify the screen you want to load. Must be TOP or BOTTOM
	\param scrollFix : Must be 1 for the loading of 512x256 bg in the game Scrolling mode. 0 otherwise. 
	*/
	int loadBackground(const unsigned int* data, int length, unsigned int bgNumber, Screen screen, bool scrollFix, Application* app);

	void reset();

	/*!	\fn displayBackgrounds
	\brief Handles the loading of the background with regards of the current game stage.
	Should be called once per frame to check if the current displayed bg is the current game bg
	\param state : The current state of the game. 
	*/
	void displayBackgrounds(AppState state, Application* app);

	/*! \fn scrollAll
	\Brief Handles the scrolling of all the backgrounds during the GAME mode
	*/

	void scrollAll(Game* game, Application* app);
	void initGameBG(Application* app);
	
};

